/*
 Copyright (C) 2008  Maurizio Monticelli

 This program is free software; you can redistribute it and/or modify it under the terms of the 
 GNU General Public License as published by the Free Software Foundation; either version 2 of the 
 License, or (at your option) any later version.

 This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without 
 even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General 
 Public License for more details.

 You should have received a copy of the GNU General Public License along with this program; if not, write 
 to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA 
*/

package ch.justdoit.andriodrpncalc.view;

import android.content.Context;
import android.widget.AbsoluteLayout;
import ch.justdoit.andriodrpncalc.model.Model;
import ch.justdoit.andriodrpncalc.model.command.*;
import ch.justdoit.andriodrpncalc.view.buttons.*;

public class KeyBaseOp extends AbsoluteLayout{
	private Model model;
	
	public static int WIDTH = 90;
	public static int HIEGHT = 120;
	
	public KeyBaseOp(Context context,  Model _model) {
		super(context);
		model = _model;
		
		setBackgroundColor(android.R.color.darker_gray);
		
        int x = 0;
        int y = 0;

        ButtonCommand btnDivision = new ButtonCommand(context, model, new DivideCommand(model));
		addView(btnDivision, 
    			new AbsoluteLayout.LayoutParams(btnDivision.WIDTH, btnDivision.HEIGHT, x , y)
    	);
		y = y + btnDivision.HEIGHT;
		
		ButtonCommand btnMultiplication = new ButtonCommand(context, model, new MultiplyCommand(model));
		addView(btnMultiplication, 
    			new AbsoluteLayout.LayoutParams(btnMultiplication.WIDTH, btnMultiplication.HEIGHT, x , y)
    	);
		y = y + btnMultiplication.HEIGHT;
		
		ButtonCommand btnMinus = new ButtonCommand(context, model, new MinusCommand(model));
		addView(btnMinus, 
    			new AbsoluteLayout.LayoutParams(btnMinus.WIDTH, btnMinus.HEIGHT, x , y)
    	);
		y = y + btnDivision.HEIGHT;
		
		ButtonCommand btnPlus = new ButtonCommand(context, model, new AddCommand(model));
		addView(btnPlus, 
    			new AbsoluteLayout.LayoutParams(btnPlus.WIDTH, btnPlus.HEIGHT, x , y)
    	);
		y = y + btnDivision.HEIGHT;
		x = x + btnPlus.WIDTH;
		
		WIDTH = x;
		HIEGHT = y;
	}
	
	

}
